<!DOCTYPE html>
<!--suppress ALL -->
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>approximatelyEqual</title>
</head>
<body>
<h4>
    Checks if two numbers are approximately equal to each other.
    Use Math.abs() to compare the absolute difference of the two values to epsilon.
    Omit the third parameter, epsilon, to use a default value of 0.001.
</h4>
<h4>
    Math.abs（）获取绝对值
    Math.PI 获取圆周率 π
</h4>
<script type="text/javascript">
    //    const approximatelyEqual = (v1, v2, epsilon = 0.001) => Math.abs(v1 - v2) < epsilon;
    //    approximatelyEqual(Math.PI / 2.0, 1.5708); // true
    const approximatelyEqual = (v1, v2, epsilon = 0.001) => Math.abs(v1 - v2) < epsilon;
    console.log(approximatelyEqual(Math.PI / 2.0, 1.5708))
</script>
</body>
</html>